package com.fili.gui;

import com.fili.gui.util.StatusBar;
import com.fili.gui.util.ActionsEngine;

import javax.swing.*;
import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 * User: fili
 * Date: Oct 1, 2006
 * Time: 10:22:47 PM
 * To change this template use File | Settings | File Templates.
 */
public class MainWindow extends JFrame
{
    private JTabbedPane tabbedPane;
    private JToolBar toolBar;
    private StatusBar statusBar;
    private JMenuBar menuBar;
    private ActionsEngine actionsEngine;

    public MainWindow()
    {
        setSize(600,400);
        setDefaultCloseOperation(EXIT_ON_CLOSE);

        actionsEngine = new ActionsEngine(this);
        MainWindowActions.setupActions(actionsEngine);

        setLayout(new BorderLayout());
        toolBar  = new JToolBar();
        toolBar.setFloatable(false);
        toolBar.add(actionsEngine.getAction(MainWindowActions.ACTION_NEW));
        toolBar.add(actionsEngine.getAction(MainWindowActions.ACTION_OPEN));
        toolBar.add(actionsEngine.getAction(MainWindowActions.ACTION_SAVE));
        toolBar.add(actionsEngine.getAction(MainWindowActions.ACTION_SAVEAS));
        toolBar.add(actionsEngine.getAction(MainWindowActions.ACTION_EXIT));
        toolBar.addSeparator();
        add(toolBar, BorderLayout.NORTH);

        menuBar = new JMenuBar();
        JMenu menu = new JMenu("File");
        menu.add(actionsEngine.getAction(MainWindowActions.ACTION_NEW));
        menu.add(actionsEngine.getAction(MainWindowActions.ACTION_OPEN));
        menu.add(actionsEngine.getAction(MainWindowActions.ACTION_SAVE));
        menu.add(actionsEngine.getAction(MainWindowActions.ACTION_SAVEAS));
        menu.addSeparator();
        menu.add(actionsEngine.getAction(MainWindowActions.ACTION_EXIT));
        menuBar.add(menu);
        setJMenuBar(menuBar);

        tabbedPane = new JTabbedPane();
        tabbedPane.addTab("Modules",new JPanel());
        tabbedPane.addTab("Frames",new JPanel());
        tabbedPane.addTab("Animations",new JPanel());
        tabbedPane.addTab("Mappings",new JPanel());


        add(tabbedPane,BorderLayout.CENTER);

        statusBar = new StatusBar("Waiting...");
        add(statusBar, BorderLayout.SOUTH);
        setVisible(true);
    }
}
